// app/index.js  把Koa在main抽离
const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
const userRoutes = require('../router');
const errorHandler = require('./error-handler');

const app = new Koa();
app.use(bodyParser()); // 解析JSON数据
userRoutes(app);
app.on('error', errorHandler);


module.exports = app;